var sys     = require('sys'), 
    http    = require('http'),
    fs = require('fs');

//var script_name      = '/some/path/to/app.js';
this.app     = require('./app').app;
var f      = './app';

fs.watchFile(f, function (curr, prev) {
	  fs.stat(f, function(err, stats){
	    if (err) throw err;
	    fs.createReadStream(f, {
	      start: startByte,
	      end: stats.size
	    }).addListener("data", function(lines) {
	      //sys.puts(lines);
  		res.writeHead(200, {'Content-Type': 'text/html'});
		res.write(lines);
		res.end();
	      startByte = stats.size;
	    });
	  });
	});



http.createServer(this.app).listen(8000);

